# Maintainer: Tao Zuhong <taozuhong@hotmail.com>

_realname=sqlite3mc
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.0
pkgrel=1
pkgdesc="SQLite3 encryption extension with support for multiple ciphers (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/utelle/SQLite3MultipleCiphers"
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
source=("https://github.com/utelle/SQLite3MultipleCiphers/archive/v${pkgver}/${_realname}-$pkgver.tar.gz")
sha256sums=('e7778297643f613bc2dabbcec8070d38a19e24b50d2faaed71b3d70ef0f0fe84')

prepare() {
  cd "${srcdir}/SQLite3MultipleCiphers-${pkgver}"

  autoreconf -fiv
}

build() {
  cd "${srcdir}/SQLite3MultipleCiphers-${pkgver}"

  mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}

  ../"SQLite3MultipleCiphers-${pkgver}"/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target="${MINGW_CHOST}" \
    --enable-static \
    --enable-shared

  make
}


package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make -j1 DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}/SQLite3MultipleCiphers-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
